import Vue from 'vue';
import Vuex from 'vuex';
import user from './modules/user';
import message from './modules/message';
// import _ from 'lodash'
Vue.use(Vuex);

const store = new Vuex.Store({
	state: {
		name: null,
		token: null,
		userInfo: null,
		skill: [],
		customerSkill: null,
		currentSkill: null,
		humanWorkflowSteps: [],
		workflowId: '',
		chatList: [],
		agentInfo: {},
		customerSubmitInfo: '',
		formDataId: '', //表单id
		formDataName: '', //表单名称
		submitFormId: '', //表单提交id
		formId: '',
		// 非班组长，onRing 查询访客携带技能组id, 班组长勾选插入访客呼叫的技能组id
		groupId: '',
		customerLocation: '', //访客地理位置
		workflowName: '', //工作流名称
		agentId: '', //坐席工号==坐席id,
		bizScenarioId: null, // 业务场景ID
		clientName: '' //访客用户名
	},
	getters: {
		//计算属性 $store.getters.属性名
	},
	mutations: {
		setChatList(state, chatList) {
			return (state.chatList = chatList);
		},

		setCustomerSkill(state, value) {
			return (state.customerSkill = value);
		},
		setCurrentSkill(state, value) {
			return (state.currentSkill = value);
		},

		setSkill(state, value) {
			return (state.skill = value);
		},
		setAgentInfo(state, agentInfo) {
			return (state.agentInfo = agentInfo);
		},

		setName(state, value) {
			return (state.name = value);
		},

		setToken(state, value) {
			return (state.token = value);
		},

		setUserInfo(state, value) {
			return (state.userInfo = value);
		},
		setWorkFlow(state, value) {
			return (state.humanWorkflowSteps = value);
		},
		setWorkflowId(state, value) {
			return (state.workflowId = value);
		},
		setWorkflowName(state, value) {
			return (state.workflowName = value);
		},
		setGroupId(state, groupId) {
			return (state.groupId = groupId);
		}
	},
	actions: {},
	modules: {
		user,
		message
	}
});

window.store = store;

export default store;
